package com.hgyc.mom.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hgyc.mom.common.enums.CommonStatus;
import com.hgyc.mom.system.entity.SysRole;
import com.hgyc.mom.system.service.SysRoleMenuService;
import com.hgyc.mom.system.service.SysRoleService;
import com.hgyc.mom.system.mapper.SysRoleMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统角色信息 服务实现类
 * </p>
 *
 * @author fwj
 * @since 2025-01-16
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {

    @Autowired
    private SysRoleMenuService sysRoleMenuService;

    @Override
    public List<SysRole> getUserRoles(Long userId) {
        return baseMapper.getUserRoles(userId);
    }

    @Override
    public List<SysRole> allRole() {
        LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>()
                .eq(SysRole::getStatus, CommonStatus.ENABLE.getValue());
        return list(wrapper);
    }

}
